import pytest
import requests

@pytest.fixture(scope="session")
def api_client():
    """全局API客户端夹具，提供基础URL配置和会话管理"""
    session = requests.Session()
    session.base_url = "http://localhost:8000"
    yield session
    session.close()

@pytest.fixture(scope="function")
def test_user_data():
    """测试用户数据生成器"""
    import time
    timestamp = int(time.time())
    return {
        "name": "测试用户",
        "email": f"test_{timestamp}@example.com",
        "age": 25
    }